package xyz.chenyongpeng.userconsumerdubbo.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import xyz.chenyongpeng.entity.ZsIndexLink;
import xyz.chenyongpeng.service.IZsIndexLinkService;
import xyz.chenyongpeng.service.IZsMapSiteService;
import xyz.chenyongpeng.service.IZsOrderService;
import xyz.chenyongpeng.to.IndexYyTo;
import xyz.chenyongpeng.to.MapSiteTo;
import xyz.chenyongpeng.userconsumerdubbo.vo.YYInfo;

import javax.validation.constraints.Null;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class IndexLinkService {

    @Autowired
    private IZsIndexLinkService zsIndexLinkService;

    @Autowired
    private IZsMapSiteService zsMapSiteService;

    @Autowired
    private IZsOrderService zsOrderService;

    public YYInfo getYyInfo(){
        ZsIndexLink zsIndexLink = zsIndexLinkService.getOne(null);
        YYInfo yyInfo = new YYInfo(zsIndexLink.getYyTitle(), zsIndexLink.getYyGoodsId().toString());
        return yyInfo;
    }

    public List<MapSiteTo> getMapSites(Map<String,Object> parms){
        return zsMapSiteService.getMapSiteList(parms);
    }

    public List<IndexYyTo> getIndexYy(String u_id,String goods_id){
        Map<String,Object> parms = new HashMap<>();
        parms.put("u_id", u_id);
        parms.put("goods_id", goods_id);
        return zsOrderService.getIndexYy(parms);
    }
}
